package com.future.domain;


import com.baomidou.mybatisplus.annotation.TableField;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class HealthDetail {
    private Long id;
    @TableField(exist = false)
    private String realName;
    private Long userId;
    @TableField(exist = false)
    private String className;
    private Integer score;
    private LocalDateTime completedAt;
    @TableField(exist = false)
    private String avatar;
    private int totalSize;
    @TableField(exist = false)
    private double averageScore;

    public String getUserId(){
        return userId.toString();
    }

    public double getAverageScore() {
        return totalSize > 0 ? (double)score/totalSize : 0;
    }
}
